package cn.broadin.app.hotel.util;

import cn.broadin.app.hotel.dialog.LoadingDialog;
import android.content.Context;

/**
 * 
 * 
 * @author   long
 * @version  1.0.0
 * @date 2015年10月21日上午11:53:24
 */
public class XDialog {
	
	private static XDialog xDialog = new XDialog();
	
	private LoadingDialog loadingDialog;
	
	
	private XDialog(){}
	
	public static XDialog getInstance(){
		return xDialog;
	}
	
	public void show(Context context){
		this.show(context, null);
	}
	
	public void show(Context context, String msg){
		if(loadingDialog != null){
			if(loadingDialog.isShowing()){
				loadingDialog.dismiss();
			}
			loadingDialog = null;
		}
		loadingDialog = new LoadingDialog(context);
		if(msg != null){
			loadingDialog.setLoadingMsg(msg);
		}
		loadingDialog.show();
	}
	
	public void hide(){
		if(loadingDialog != null){
			if(loadingDialog.isShowing()){
				loadingDialog.dismiss();
			}
			loadingDialog = null;
		}
	}

}
